﻿using HCQ2_Model.APPModel.ParamModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HCQ2_Model
{
    public class OnLineUserModel: BaseAPI
    {
        public int on_id { get; set; }
        public int user_id { get; set; }
        public string user_name { get; set; }
        [Required]
        public int file_id { get; set; }
        public string file_name { get; set; }
        [Required(ErrorMessage = "folder_name：体验项目必填项")]
        public string folder_name { get; set; }
        [Required(ErrorMessage = "in_date：进入时间必填项 格式： yyyyMMddHHmmss")]
        public string in_date { get; set; }
        public string line_status { get; set; }

        public T_VROnLineUser ToEntity()
        {
            return new T_VROnLineUser
            {
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                in_date = DateTime.ParseExact(this.in_date, "yyyyMMddHHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None),
                line_status = this.line_status
            };
        }
    }
    public partial class T_VROnLineUser
    {
        public OnLineUserModel ToPOCO()
        {
            return new OnLineUserModel
            {
                on_id = this.on_id,
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                in_date = this.in_date.ToString("yyyy-MM-dd HH:mm"),
                line_status = this.line_status
            };
        }
    }
}
